package com.dongdongshop.config;

import com.sun.org.apache.regexp.internal.RE;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

@Configuration
public class MyFreemarkerConfig {
    @Bean
    public FreeMarkerConfigurer freeMarkerConfigurer(){
        FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
        //第二部:创建模板所在的路径
        freeMarkerConfigurer.setTemplateLoaderPath("classpath:freemarker");
        //第三步:设置默认编码
        freeMarkerConfigurer.setDefaultEncoding("utf-8");
        return freeMarkerConfigurer;
    }

}
